import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import coursebyid from "./views/course/coursebyid.vue"
import watchuser from "./views/user/watchuser.vue"
import packageCourse from "./views/packages/packageCourse.vue"
import oss from "./views/oss/index.vue"
import lessionByid from "./views/lession/lessionByid.vue"
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      redirect: "/login",
    },
    {
      path: '/admin',
      name: 'admin',
      component: () => import(/* webpackChunkName: "about" */ './views/admin/index.vue'),
      children: [
        {
          path: '/watchcourse',
          name: 'watchcourse',
          component: () => import('./views/course/watchcourse.vue')
        },
        {
          path: '/coursebyid/:courseId',
          name: 'coursebyid',
          component: coursebyid,
          props: true

        },
        {
          path: '/watchpackage',
          name: 'watchpackage',
          component: () => import('./views/packages/watchpackage.vue')
        },
        {
          path: '/user',
          name: 'user',
          component: () => import('./views/user/index.vue')
        },
        {
          path: '/watchuser/:userId',
          name: 'watchuser',
          component: watchuser,
          props: true
        },
        {
          path: '/packageCourse/:packageId',
          name: 'packageCourse',
          component: packageCourse,
          props: true
        },
        {
          path: '/lessionByid/:lid',
          name: 'lessionByid',
          component: lessionByid,
          props: true
        },
        {
          path: '/oss',
          name: 'oss',
          component: oss
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('./views/login/index.vue')
    },

  ]
})
